<%@ page contentType="text/html;charset=UTF-8" language="java" trimDirectiveWhitespaces="true" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <meta name="format-detection" content="email=no">
    <title>荩美国际商城</title>
    <link rel="stylesheet" type="text/css" href="/resources/frontcss/aui/aui.css" />
    <link rel="stylesheet" type="text/css" href="/resources/frontcss/Hui.css" />
    <link rel="stylesheet" type="text/css" href="/resources/frontcss/aui/common.css" />
    <link rel="stylesheet" href="/resources/frontcss/magic-check.css" type="text/css"/>
    <script src="/resources/js/jquery-1.8.1.min.js" type="text/javascript"></script>
    <style>
        .top-cot{ width:100%; height:2.2rem; line-height:2.2rem; background:#28163d; color:#fff; text-align:center; font-size:16px;}
    </style>
    <style type="text/css">
        .aui-list-view-cell:active {
            background: #FFFFFF;
        }
        .aui-right {
            color: #999;
            font-size: 14px;
            margin-right: 18px;
            line-height: 26px
        }
        .payclass .aui-input-row .aui-input-addon {
            font-size: 16px;
            font-weight: 400;
            line-height: 1;
            color: #000;
            text-align: center;
            display: table-cell;
            width: 1%;
            white-space: nowrap;
            vertical-align: middle;
            padding: 0px;
        }
        .payclass .aui-input {
            text-align: right;
            margin-right: 15px;
        }
        .payclass .aui-input-row:first-child:after {
            border-top: 0px solid #e2e2e2;
        }
        .aui-counter-box {
            width: 100%;
            line-height: 15px;
            height: 30px;
            font-size: 14px;
            font-weight: 500
        }
        .aui-list-view-cell:after {
            border-bottom: 1px solid #f4f4f4;
            width: 90%;
            float: right;
        }
        .order {
            background: #ffffff;
        }
        .order-info {
            font-size: 0.875em;
            width: 100%;
        }
        .order-info span {
            color: #333;
            margin-right: 5px;
        }
        .order-info time {
            color: #999999;
            font-size: 0.75em;
        }
        .order-info i.aui-iconfont {
            color: #999;
            font-size: 0.875em;
        }
        .order-icon img {
            width: 80%;
            border-radius: 5px;
        }
        .order-title {
            font-size: 1em;
            color: #333;
            padding-bottom: 10px;
            margin-bottom: 10px;
        }
        .order-title > i.aui-iconfont {
            font-size: 14px;
            color: #999999;
        }
        p.goods-list {
            font-size: 14px;
            color: #999;
            margin-bottom: 4px;
        }
        p.count-info {
            font-size: 14px;
            color: #999;
            padding-bottom: 3px;
        }
        p.count-info span {
            margin: 0 3px;
        }
        p.count-info strong {
            color: #666;
            font-size: 16px;
            font-weight: 700;
        }
        .btn {
            /*margin: 5px;*/
        }
        .btn .aui-btn {
            font-size: 0.75em;
        }
        .btn .aui-btn:first-child {
            margin-right: 10px;
        }
        .aui-border-b:after {
            border-color: #ddd;
        }
        .afterborder:after {
            border-bottom: none !important;
        }
        .afterborder {
            border-top: 1px solid #f4f4f4;
        }
        .aui-tips-content {
            line-height: 45px;
            height: 45px;
            padding-left: 10px;
            padding-right: 10px;
        }
        .aui-list-view {
            line-height: 30px;
        }
        .aui-list-view i.iconfont {
            padding: 5px;
            border-radius: 4px;
            margin-right: 10px;
            color: #ffffff;
            font-size: 1.125em;
        }
        .aui-list-view .aui-img-object {
            max-width: 30px;
            height: 30px;
            line-height: 30px;
        }
        .aui-radio {
            margin: 0;
        }
        .aui-btn-ff9800 {
            background: #ff9800;
            color: #fff;
            padding: 8px 40px;
        }
        .aui-content {
            margin-bottom: 0 !important
        }
        .aui-list-view-cell:last-child:after {
            border: none
        }
        .aui-counter-box {
            width: 100%;
            padding: 0;
            line-height: 26px;
        }
        .aui-list-view .aui-img-object {
            max-width: 70px;
            height: 70px;
            line-height: 70px;
        }
        .aui-list-view-cell:last-child:after {
            left: 0;
        }
        .aui-list-view-cell:after {
            left: 15px;
        }
        .aui-list-view-cell:active {
            background: #fff;
        }
        .aui-nav .aui-bar-tab {
            background: #34495E;
        }
        .aui-nav .aui-bar-tab li .aui-iconfont, .aui-nav .aui-bar-tab li p {
            color: #fff;
        }
        .aui-nav .aui-bar-tab li.active .aui-iconfont, .aui-nav .aui-bar-tab li.active p {
            color: #14bd7c;
        }
        .aui-nav {
            background: #fff;
            font-size: 18px;
            color: #fff;
            text-align: center;
        }
        .aui-nav div {
            height: 55px;
        }
        .aui-nav .buy {
            line-height: 55px;
        }
        .blue {
            background: #fff;
        }
        .blue .aui-iconfont, .blue p {
            color: #999;
        }
        .buy {
            background: #FF9800;
        }
        .aui-input-row:first-child:after {
            border-top: 0px solid #c8c7cc;
        }
        .aui-input-row .aui-input-addon {
            width: auto;
        }
        .aui-input-row:last-child:after {
            border-bottom: 0px solid #000;
        }
        .heji {
            font-size: 14px;
            vertical-align: middle;
            white-space: nowrap;
            line-height: 55px;
        }
        .shopcar {
            font-size: 20px;
            margin-left: 20px;
        }
        .xsgdnoborder:after {
            border: none
        }
    </style>
</head>
<body>
<div class="top-cot">我的资金</div>

<div class="H-flexbox-horizontal  H-border-vertical-bottom-after">
    <div class="H-flex-item H-padding-10">
        <div class="H-font-size-14 H-theme-font-color-999 H-text-show-row-2 H-margin-vertical-top-2">
            可提现金额:<span id="cash">${money.cash}</span>元
        </div>
    </div>
</div>
<ul class="aui-list-view aui-in" style="margin-bottom: 0px;">
    <li class="aui-list-view-cell" style="padding:0 0 0 10px;font-size: 14px !important">
        <div class="aui-input-row">
            <span class="aui-input-addon" style="font-size: 16px !important">提现金额</span>
            <input id="amount" name="amount"  type="text" class="aui-input" placeholder="请输入提现金额" value="" onkeyup="countAmount()">
        </div>
    </li>
</ul>
<li class="afterborder aui-list-view-cell" style="color: #808080;font-size: 14px !important">
    提现方式
</li>
<div class="payclass aui-content" style="color:#818181;font-size: 14px !important">
    <ul class="aui-list-view aui-in">
        <li class="aui-list-view-cell aui-img">
            微信提现
            <div class="aui-pull-right">
                <input value="1" id="type0"   class="H-border-radius-circle aui-radio aui-radio-danger" type="radio" name="type"  onclick="showRemark(0)" checked>
            </div>
        </li>
        <li class="aui-list-view-cell aui-img">
            银行卡提现
            <div class="aui-pull-right">
                <input value="2" class="H-border-radius-circle aui-radio aui-radio-danger" type="radio" name="type"  id="type1" onclick="showRemark(1)" >
            </div>
        </li>

        <li id="bankName_label" style="display: none;">
            <input type="text" name="bankName" id="bankName" value="${user.bankName}" class="info-response-width" placeholder="请输入银行名称">
        </li>

        <li id="cardNo_label" style="display: none;">
            <input type="text" name="cardNo" id="cardNo" value="${user.cardNo}" class="info-response-width" placeholder="请输入卡号">
        </li>

        <li id="cardName_label" style="display: none;">
            <input type="text" name="cardName" id="cardName" value="${user.cardName}" class="info-response-width" placeholder="请输入持卡人名称">
        </li>

        <li id="amount_label" style="display: none;">
            到账金额：<span id="dz_amount">0</span>元
        </li>
        <input type="hidden" name="remark" id="remark" value="" class="info-response-width" placeholder="备注">
    </ul>
</div>

<div class="H-flexbox-horizontal">
    <div class="H-flex-item H-padding-10">
        <div style="color: #f6ad3c;" class="H-font-size-14  H-margin-vertical-top-2">
            <p style="color: #f6ad3c;">
                友情提示：
                <br/>
                微信红包提现每次最高200，每日最多提现5次（秒到）；大额资金提现可转到银行卡（每笔3‰手续费），工作日内当天到账（周一至周五下午四点统一处理），节假日顺延。
            </p>
        </div>
    </div>
</div>

<div class="H-padding-10">
    <button  onclick="submit()" id="order_add_submit2" class="H-button H-width-100-percent H-font-size-15 H-outline-none H-padding-vertical-both-12 H-padding-horizontal-both-10 H-theme-background-color4 H-theme-font-color-white H-theme-border-color4 H-theme-border-color4-click H-theme-background-color4-click H-theme-font-color4-click H-border-radius-3">
        提现
    </button>
</div>


<script type="text/javascript">

    function showRemark(i){
        if(i==0){
            $("#bankName_label").hide();
            $("#cardNo_label").hide();
            $("#cardName_label").hide();
            $("#amount_label").hide();
        }else if(i==1){
            $("#bankName_label").show();
            $("#cardNo_label").show();
            $("#cardName_label").show();
            $("#amount_label").show();
        }
    }

    function countAmount(){
        var type = $("input[name='type']:checked").val();
        var amount = $("#amount").val();
        if(!isNaN(amount)){//数字格式
            $.ajax({
                url:"/front/user/getTxAmount?r="+Math.random(),
                type:"post",
                data:{
                    amount:amount
                },
                success:function(res){
                    if(res.success)
                        $("#dz_amount").html(res.data);
                },
                error:function(){}
            })
        }
    }

    function submit(){

        var amount = $("#amount").val();
        if(amount==""){
            alert("请输入提现金额！");
            return ;
        }
        if(isNaN(amount)){
            alert("提现金额请输入数字格式！");
            return ;
        }
        var cash = parseFloat($("#cash").html());
        if(parseFloat(amount)>cash){
            alert("提现的金额不能超过可用金额！");
            return ;
        }
        var type = $("input[name='type']:checked").val();
        if(type=='1') {
            if (parseFloat(amount) > 200) {
                alert("微信提现金额不能超过200元！");
                return;
            }
        }else if(type=='2'){
            if (parseFloat(amount) < 200) {
                alert("银行卡提现金额不能超过200元！");
                return;
            }
            var bankName = $("#bankName").val();
            if(bankName==""){
                alert("请输入提现银行名称！");
                return ;
            }
            var cardNo = $("#cardNo").val();
            if(cardNo==""){
                alert("请输入卡号！");
                return ;
            }
            var cardName = $("#cardName").val();
            if(cardName==""){
                alert("请输入持卡人名称！");
                return ;
            }
        }
        if(confirm("确定要提现吗？")){
            $("#order_add_submit2").attr("disabled",true);
            $.ajax({
                url:"/front/user/amount/tx?r="+Math.random(),
                type:"post",
                data: {
                    type:type,
                    amount:amount,
                    bankName:$("#bankName").val(),
                    cardName:$("#cardName").val(),
                    cardNo:$("#cardNo").val(),
                    remark:$("#remark").val()

                },
                success:function (res) {
                    alert(res.msg);
                    $("#order_add_submit2").removeAttr("disabled");
                    if(res.success){
                        window.location.href = "/front/user/main";
                    }
                },
                error:function () {
                    $("#order_add_submit2").attr("disable",false);
                }
        })
        }
    }
</script>
</body>
</html>